import { Form, Input, InputNumber, Select } from 'antd';
import { useState } from 'react';
import an58 from '@mmstudio/an000058';
import AddButton from '../../components/addbutton';
import api from '../../atoms/api';
import { Message as M1, Result as R1 } from '../api/class/lzqxinzeng.api';


export default function Lzqxinzeng() {
	const [d, setd] = useState({} as M1);
	return <>
		<AddButton dlgtitle='班级管理' onSave={async () => {
			if (!d
				|| !d.grade
				|| !d.
					majorname








				|| !d.classname
				|| !d.monitorname
				|| !d.studycommitteename
			) {
				return '缺少必要的参数';
			}
			const res = await an58<R1, M1>(api['/api/class/lzqxinzeng'], 'post', d);
			if (res.ok === true) {
				return true;
			}
			return res.message;
		}
		} >

			<Form.Item required label="年级:">
				<InputNumber min={'2000'} placeholder='请输入年级'
					value={d.grade} onChange={(e) => {
						setd({
							...d,
							grade: e

						});
					}} />
			</Form.Item>
			<Form.Item required label="专业:">
				<Input placeholder='请输入专业' value={d.majorname} onChange={(e) => {
					setd({
						...d,
						majorname: e.target.value
					});
				}} />
			</Form.Item>
			<Form.Item required label="班级名称:">
				<Input placeholder='请输入班级名称' value={d.classname} onChange={(e) => {
					setd({
						...d,
						classname: e.target.value
					});
				}} />
			</Form.Item>
			<Form.Item required label="班长姓名:">
				<Input placeholder='请输入班长姓名' value={d.monitorname} onChange={(e) => {
					setd({
						...d,
						monitorname: e.target.value
					});
				}} />
			</Form.Item>
			<Form.Item required label="学委姓名:">
				<Input placeholder='请输入学委姓名' value={d.studycommitteename} onChange={(e) => {
					setd({
						...d,
						studycommitteename: e.target.value
					});
				}} />
			</Form.Item>
		</AddButton>
	</>;
}
